import {defineStore} from 'pinia'
import {ref} from 'vue'
export const useUserStore = defineStore('user',() => {
    const token = ref('')

    const setToken = (newToken) => {
        token.value = newToken
    }
    const remToken = () => {
        token.value = ''
    }

    const user = ref({
        id:'',
        userName:'',
        userType:''
    })


    const setUserName = (userName) => {
        user.value.userName = userName
    }
    const setId = (id) => {
        user.value.id = id
    }
    const setUserType = (userType) => {
        user.value.userType = userType
    }

    return {
        token,setToken,remToken,
        user,setUserName,setId,setUserType
    }
},{persist:true})